package org.etcsoft.examples.saniker;

import java.io.File;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class FileTreeContentProvider implements ITreeContentProvider {

    public Object[] getElements(Object inputElement) {
      return (File[]) inputElement;
    }

    public Object[] getChildren(Object parentElement) {
      File file = (File) parentElement;
      return file.listFiles();
    }

    public Object getParent(Object element) {
      File file = (File) element;
      return file.getParentFile();
    }

    public boolean hasChildren(Object element) {
      File file = (File) element;
      if (file.isDirectory()) {
        return true;
      }
      return false;
    }

	public void dispose() {
		// TODO Auto-generated method stub
		
	}

	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		// TODO Auto-generated method stub
		
	}

}
